﻿using UnityEngine;
using UnityEngine.UI;

namespace Yoozoo.Extension
{
    /// <summary>
    /// Selectable.m_TargetGraphic只能选择一个物件
    /// 用这个组件进行中转，可以选择一组物件
    /// 目前只支持 Color Transition
    /// </summary>
    public class SelectableTargetGraphicsGroup : Graphic
    {
        protected SelectableTargetGraphicsGroup()
        {
            useLegacyMeshGeneration = false;
        }

        public Graphic[] Group;

        public override void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha)
        {
            if (Group == null) return;

            foreach (var graphic in Group)
            {
                graphic.CrossFadeColor(targetColor, duration, ignoreTimeScale, false, true);
            }
        }

        public override void SetVerticesDirty()
        {

        }

        public override void SetMaterialDirty()
        {

        }
    }
}
